package org.ntu.csn.doraemon.canvas;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;

import org.ntu.csn.doraemon.model.Mark;


public class SucForm implements CommandListener,ResultForm {
	
	private Form msgForm;
	
	public StartMenu sm;	
	
	private SaveForm sf;
	
	private Mark mark;
	
	

	public SucForm(StartMenu sm) {
		this.sm = sm;
		showDeadMsg();
	}

	public void showDeadMsg() {
		msgForm = new Form("You Win");
		msgForm.append("Do you want to save this round");     
        msgForm.addCommand(Listener.yes);
        msgForm.setCommandListener(this);
        msgForm.addCommand(Listener.no);
        msgForm.setCommandListener(this);
	}

	public void commandAction(Command c, Displayable d) {
		if ( c == Listener.yes) {
			sf = new SaveForm(this,sm);
			 Display.getDisplay(sm).setCurrent(this.sf.getSaveForm());
       } else if ( c == Listener.no) {
    	   Display.getDisplay(sm).setCurrent(StartMenu.mainMenu);
       }
	}

	public Form getMsgForm() {
		return msgForm;
	}

	public void setMsgForm(Form msgForm) {
		this.msgForm = msgForm;
	}
	
	public void setMark(Mark m) {		
		mark = m;
	}

	public Mark getMark() {
		return mark;
	}
	
}
